// FFileSystem.cpp (c) 2011 JV Software
//

#include "EnginePrivate.h"
#include "FFileSystemLocal.h"

FFileSystemLocal	fileSystemLocal;
ENGINE_API FFileSystem *fileSystem = &fileSystemLocal;

FString				basePath = TEXT("./base/");

/*
============
FFileSystemLocal::Init
============
*/
void FFileSystemLocal::Init( void ) {
	engine->Printf( TEXT("----------- FS_Init -----------\n") );
	engine->Printf( TEXT("Base Path: \"Base\" \n") );
	searchPaths.Append( basePath );
}

/*
============
FFileSystemLocal::OpenFile
============
*/
FFile *FFileSystemLocal::OpenFile( FString path ) {
	FILE *handle = _wfopen( ((FString)searchPaths[0] + path).c_str(), TEXT("rb") );

	if(!handle) {
		return NULL;
	}

	FFileLocal *file = AllocObject(FFileLocal);
	file->OpenFile( handle );
	return file;
}
